package org.ytor.core.sysapi.depart.resp;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.ytor.common.anno.Dict;
import org.ytor.common.util.tree.ITree;
import org.ytor.core.model.BaseResp;
import org.ytor.core.sysapi.depart.model.SysDepart;

import java.util.List;

/**
 * created by yangtong on 2025年6月2日 21:35:23
 * <br/>
 * 部门表Resp表实体类
 * <br/>
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "部门表")
public class SysDepartResp extends BaseResp<SysDepart, String> implements ITree<SysDepartResp> {

    /**
     * 主键id
     */
    private String id;

    /**
     * 用户id
     */
    private String userId;

    /**
     * 该部门是否为用户当前部门
     */
    private Boolean currentDepart;

    /**
     * 上级部门id
     */
    @Schema(description = "上级部门id")
    @Dict(table = "sys_depart", code = "id", text = "depart_name")
    private String pid;

    /**
     * 部门名称
     */
    @Schema(description = "部门名称")
    private String departName;

    /**
     * 部门类型
     */
    @Schema(description = "部门类型")
    @Dict(code = "depart_type")
    private Integer type;

    /**
     * 部门联系人username
     */
    @Schema(description = "部门联系人username")
    @Dict(table = "sys_user", code = "user_name", text = "real_name")
    private String contactUserName;

    /**
     * 部门地址
     */
    @Schema(description = "部门地址")
    private String address;

    private List<SysDepartResp> children;

    private Boolean hasChildren = false;

    @Override
    public String getKey() {
        return departName;
    }

    @Override
    public void hasChildren(Boolean hasChildren) {
        this.hasChildren = hasChildren;
    }
}